#ifndef P16E_INST_H
#define P16E_INST_H

// --- P16Fxxxx instruction set ---
#define _ADDWF		(char*)"addwf"
#define _ANDWF		(char*)"andwf"
#define _CLRF		(char*)"clrf"
#define _CLRW		(char*)"clrw"
#define _COMF		(char*)"comf"
#define _DECF		(char*)"decf"
#define _DECFSZ		(char*)"decfsz"
#define _INCF		(char*)"incf"
#define _INCFSZ		(char*)"incfsz"
#define _IORWF		(char*)"iorwf"
#define _MOVF		(char*)"movf"
#define _MOVWF		(char*)"movwf"
#define _RLF        (char*)"rlf"
#define _RRF        (char*)"rrf"
#define _SUBWF		(char*)"subwf"
#define _NOP		(char*)"nop"
#define _SWAPF		(char*)"swapf"
#define _XORWF		(char*)"xorwf"
#define _BCF		(char*)"bcf"
#define _BSF		(char*)"bsf"
#define _BTFSC		(char*)"btfsc"
#define _BTFSS		(char*)"btfss"
#define _CALL		(char*)"call"
#define _GOTO		(char*)"goto"
#define _RETFIE		(char*)"retfie"
#define _RETLW		(char*)"retlw"
#define _RETURN		(char*)"return"
#define _ADDLW		(char*)"addlw"
#define _ANDLW		(char*)"andlw"
#define _IORLW		(char*)"iorlw"
#define _MOVLW		(char*)"movlw"
#define _SUBLW		(char*)"sublw"
#define _XORLW		(char*)"xorlw"
#define _SLEEP		(char*)"sleep"

// Enhanced PIC16 instructions
#define _ADDWFC		(char*)"addwfc"
#define _SUBWFB		(char*)"subwfb"
#define _LSLF		(char*)"lslf"		// logical shift left
#define _LSRF		(char*)"lsrf"		// logical shift right
#define _ASRF		(char*)"asrf"		// arithmatic shift right
#define _MOVLP		(char*)"movlp"		// load PCLATH
#define _MOVLB		(char*)"movlb"		// load BSR
#define _BRA		(char*)"bra"
#define _BRW		(char*)"brw"
#define _CALLW		(char*)"callw"
#define _ADDFSR		(char*)"addfsr"
#define _MOVIW		(char*)"moviw"
#define _MOVWI		(char*)"movwi"
#define _RESET		(char*)"reset"
#define _CLRWDT		(char*)"clrwdt"

// pseudo instructions
#define _BSEL		(char*)".bsel"
#define _PSEL		(char*)".psel"
#define _SEGMENT	(char*)".segment"
#define _END		(char*)".end"
#define _RS			(char*)".rs"
#define _EQU		(char*)".equ"
#define _FCALL		(char*)".fcall"
#define _DW         (char*)".dw"
#define _INVOKE		(char*)".invoke"
#define _DEVICE		(char*)".device"

// rv32I instructions
#define _ADD        (char*)"add "
#define _ADDI       (char*)"addi"
#define _SUB        (char*)"sub "
#define _AND        (char*)"and "
#define _ANDI       (char*)"andi"
#define _OR         (char*)"or  "
#define _ORI        (char*)"ori "
#define _SLL        (char*)"sll "
#define _SLLI       (char*)"slli"
#define _SRL        (char*)"srl "
#define _SRLI       (char*)"srli"
#define _SRA        (char*)"sra "
#define _SRAI       (char*)"srai"
#define _SLT        (char*)"slt "
#define _SLTI       (char*)"slti"
#define _SLTU       (char*)"sltu"
#define _SLTIU      (char*)"sltiu"

#define _BEQ        (char*)"beq "
#define _BNE        (char*)"bne "
#define _BGE        (char*)"bge "
#define _BGEU       (char*)"bgeu"
#define _BLT        (char*)"blt "
#define _BLTU       (char*)"bltu"
#define _JAL        (char*)"jal "
#define _JALR       (char*)"jalr"
#define _ECALL      (char*)"ecall"
#define _EBREAK     (char*)"ebreak"

#define _LB         (char*)"lb  "
#define _SB         (char*)"sb  "
#define _LBU        (char*)"lbu "
#define _LH         (char*)"lh  "
#define _SH         (char*)"sh  "
#define _LHU        (char*)"lhu "
#define _LW         (char*)"lw  "
#define _SW         (char*)"sw  "
#define _LUI        (char*)"lui "
#define _AUIPC      (char*)"auipc"
#define _FENCE      (char*)"fence"


#define _JR         (char*)"jr  "           // pseudo-directives
#define _CALL       (char*)"call"           // pseudo-directives
#define _LI         (char*)"li  "           // pseudo-directives
#define _MV         (char*)"mv  "           // pseudo-directives
#define _J          (char*)"j   "           // pseudo-directives

// rv32m
#define _MULH       (char*)"mulh"
#define _DIV        (char*)"div "
#define _MUL        (char*)"mul "
#define _REM        (char*)"rem "
#define _REMU       (char*)"remu"
#define _MULHU      (char*)"mulhu"
#define _DIVU       (char*)"divu"
#define _MULHSU     (char*)"mulhsu"    

// rigister

#define _R_X0         (char*)"x0"
#define _R_RA         (char*)"ra"
#define _R_SP         (char*)"sp"
#define _R_GP         (char*)"gp"
#define _R_TP         (char*)"tp"
#define _R_T0         (char*)"t0" // x5
#define _R_T1         (char*)"t1"
#define _R_T2         (char*)"t2"
#define _R_S0         (char*)"s0"
#define _R_S1         (char*)"s1" 
#define _R_A0         (char*)"a0" // x10
#define _R_A1         (char*)"a1"
#define _R_A2         (char*)"a2"
#define _R_A3         (char*)"a3"
#define _R_A4         (char*)"a4"
#define _R_A5         (char*)"a5" // x15
#define _R_A6         (char*)"a6"
#define _R_A7         (char*)"a7"
#define _R_S7         (char*)"s7"
#define _R_S2         (char*)"s2"
#define _R_S3         (char*)"s3" // x20
#define _R_S4         (char*)"s4"
#define _R_S5         (char*)"s5"
#define _R_S6         (char*)"s6"
#define _R_S7         (char*)"s7"
#define _R_S8         (char*)"s8" // x25
#define _R_S9         (char*)"s9"
#define _R_S10        (char*)"s10"
#define _R_S11        (char*)"s11"
#define _R_T3         (char*)"t3"
#define _R_T4         (char*)"t4" // x30
#define _R_T5         (char*)"t5"
#define _R_T6         (char*)"t6"

#endif
